package com.duoduo.demo.springnoxml.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class AppService {

	@Value("${app.title}")
	private String appTitle;
	@Value("${app.version}")
	private String appVersion;
	@Value(value = "${app.locale}")
	private String appLocale;

	@Value("${app.title.label}")
	private String appTitleLabel;
	@Value("${app.version.label}")
	private String appVersionLabel;
	@Value(value = "${app.locale.label}")
	private String appLocaleLabel;

	@Value(value = "${home.head.title}")
	private String homeHeadTitle;
	@Value(value = "${home.about.title}")
	private String homeAboutTitle;

	public Map<String, String> getSystemInfo() {
		Map<String, String> map = new HashMap<String, String>(0);
		map.put("appTitle", appTitle);
		map.put("appVersion", appVersion);
		map.put("appLocale", appLocale);

		map.put("homeHeadTitle", homeHeadTitle);
		map.put("homeAboutTitle", homeAboutTitle);
		return map;
	}

	public void showSystemInfo() {
		System.out.println(String.format("%s：%s, %s：%s, %s：%s", appTitleLabel, appTitle, appVersionLabel, appVersion,
				appLocaleLabel, appLocale));
	}
}
